//
//  NSObject+PYIsValidString.m
//  catuncel
//
//  Created by Jim on 2017/12/3.
//  Copyright © 2017年 Jim. All rights reserved.
//

#import "NSObject+PYIsValidString.h"

@implementation NSObject (PYIsValidString)

- (BOOL)isValidString
{
    if (self) {
        
        if ([self isKindOfClass:[NSString class]]) {
            
            NSString *str = (NSString *)self;
            
            if (str.length > 0) {
                
                return YES;
            }
        
        } else if ([self isKindOfClass:[NSNumber class]]) {
            
            NSNumber *num = (NSNumber *)self;
            
            if (num.integerValue > 0) {
                
                return YES;
            }
        }
    }
    
    return NO;
}
@end
